package com.trivera.adhoc;

public class TaxableEntityFactory {

	public static TaxableEntity createEntity(String name, String taxId)
	{
		// BRUTE FORCE FACTORY - BETTER MECHANISMS EXIST!
		if (taxId.matches(Company.COMPANY_TAXID_REGEX))
		{
			return new Company(name, taxId);
		}
		else if (taxId.matches(Employee.EMPLOYEE_TAXID_REGEX))
		{
			return new Employee(name, taxId);
		}
		else
		{
			throw new IllegalArgumentException("No class found for taxid");
		}
	}
	
}
